package com.example.cal_manage;


import java.util.Calendar;

import android.app.Activity;
import android.content.Intent;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle;
import android.util.Log;
import android.widget.LinearLayout;

public class Tab2Activity extends Activity {  
    public void onCreate(Bundle savedInstanceState) {  
        super.onCreate(savedInstanceState);  
        setContentView(R.layout.sub);   

  
        //TextView textview = new TextView(this);  
        //textview.setText("This is Tab2");  
        //setContentView(textview); 
        
        AverageTemperatureChart atc;   
	      LinearLayout chart_area = (LinearLayout) findViewById(R.id.chart_area);   
	        atc = new AverageTemperatureChart();   
	        chart_area.addView(atc.execute(this));
	        
	        /*MyOpenHelper helper = new MyOpenHelper(this);
			SQLiteDatabase db = helper.getReadableDatabase();
			Calendar cal1 = Calendar.getInstance();
		    String year = String.valueOf(cal1.get(Calendar.YEAR));
		    String month = String.valueOf(cal1.get(Calendar.MONTH)+1);
		    String day = String.valueOf(cal1.get(Calendar.DAY_OF_MONTH));
		    Log.e(year, month);
		    Log.e(day, "msg2");
			Cursor c = db.rawQuery("select Weight from CalManagement where Year == "+year+" and Month == "+month+";",new String[]{});
			
			double[] v = new double[40];
			
			for(int i = 0;i<=31;i++){
				if(c.moveToNext()){
					v[i]=c.getDouble(0);
				}else{
					v[i]=0;
				}
			}
			Intent intent = new Intent(Tab2Activity.this,AverageTemperatureChart.class);
			String a = "a";
			intent.putExtra("Array", a);
			startActivity(intent);
			db.close();
			c.close();*/
    }  
}  
